 create database Survey
go
use Survey
go

 create table Account 
 (
 AccountID int identity(1,1) primary key
 Ip varchar(20),
 TimeLogin smalldatetime,
 TimeLogout smalldatetime,
 [Status] bit
 ) 

 create table SurveyDetail
 (
 SurveyID int identity(1,1) primary key,
 AccountID int,
 Constraint PK_Survey Foreign key (AccountID) references Account(AccountID)
 )

create table Question
(
	QuestionID int identity(1,1) primary key,
	SurveyID int ,
	QuestionContent nvarchar(max),
	Constraint PK_Question Foreign key (SurveyID) references SurveyDetail(SurveyID)

)
create table Answer(
	AnswerID int identity(1,1) primary key,
	QuestionID int ,
	AnsewrContent nvarchar(max),
	Constraint PK_Ansewr Foreign key (QuestionID) references Question(QuestionID)
)

Create table Friend(
	AccountID int ,
	FriendID int,
	[Status] bit,
	Constraint Pk_You Foreign key (AccountID) references Account(AccountID),
	Constraint PK_Friend Foreign key (FriendID) references Account(AccountID)
	primary key 
)